package com.spic.business.informatization.fixedContent.service.impl;

import com.spic.business.common.datascope.anotation.BusinessDataScope;
import com.spic.business.informatization.fixedContent.domain.FixedContent;
import com.spic.business.informatization.fixedContent.mapper.FixedContentMapper;
import com.spic.business.informatization.fixedContent.service.IFixedContentService;
import com.spic.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 培训课件Service业务层处理
 * 
 * @author spic
 * @date 2021-10-15
 */
@Service
public class FixedContentServiceImpl implements IFixedContentService
{
    @Autowired
    private FixedContentMapper fixedContentMapper;

    /**
     * 查询培训课件
     * 
     * @param id 培训课件主键
     * @return 培训课件
     */
    @Override
    public FixedContent selectFixedContentById(String id)
    {
        return fixedContentMapper.selectFixedContentById(id);
    }

    /**
     * 查询培训课件列表
     * 
     * @param fixedContent 培训课件
     * @return 培训课件
     */
    @Override
    @BusinessDataScope( menuPath = "business/train/courseware/index")
    public List<FixedContent> selectFixedContentList(FixedContent fixedContent)
    {
        return fixedContentMapper.selectFixedContentList(fixedContent);
    }

    /**
     * 新增培训课件
     * 
     * @param fixedContent 培训课件
     * @return 结果
     */
    @Override
    public int insertFixedContent(FixedContent fixedContent)
    {
        fixedContent.setCreateTime(DateUtils.getNowDate());
        return fixedContentMapper.insertFixedContent(fixedContent);
    }

    /**
     * 修改培训课件
     * 
     * @param fixedContent 培训课件
     * @return 结果
     */
    @Override
    public int updateFixedContent(FixedContent fixedContent)
    {
        return fixedContentMapper.updateFixedContent(fixedContent);
    }

    /**
     * 批量删除培训课件
     * 
     * @param ids 需要删除的培训课件主键
     * @return 结果
     */
    @Override
    public int deleteFixedContentByIds(String[] ids)
    {
        return fixedContentMapper.deleteFixedContentByIds(ids);
    }

    /**
     * 删除培训课件信息
     * 
     * @param id 培训课件主键
     * @return 结果
     */
    @Override
    public int deleteFixedContentById(String id)
    {
        return fixedContentMapper.deleteFixedContentById(id);
    }

    @Override
    public List<FixedContent> selectFixedContentByIds(List<String> ids) {
        return fixedContentMapper.selectBatchIds(ids);
    }
    @Override
    public List<String> selectUrlByIds(List<String> coursewareIds){
        return fixedContentMapper.selectUrlByIds(coursewareIds);
    }
}
